<form class="form-horizontal padding-15">
    <div id="content_type">
        <!--<ul class="nav nav-tabs v-nav-tabs" role="tablist" style="margin-left: 14px;margin-right: 14px;">-->
            <!--<li role="presentation" class="active"><a href="#mall" aria-controls="mall" role="tab" data-toggle="tab" data-type="1" class="flex-auto-center">商城海报</a></li>-->
            <!--<li role="presentation"><a href="#goods" aria-controls="goods" role="tab" data-toggle="tab" data-type="2" class="flex-auto-center">商品海报</a></li>-->
            <!--<li role="presentation"><a href="#follow" aria-controls="follow" role="tab" data-toggle="tab" data-type="3" class="flex-auto-center">关注海报</a></li>-->
                                       <!--{if $microshop}-->
            <!--<li role="presentation"><a href="#mini_shop" aria-controls="mini_shop" role="tab" data-toggle="tab" data-type="4" class="flex-auto-center">微店海报</a></li>-->
            <!--{/if}-->
        <!--</ul>-->
        <div class="template-list tab-content">
            <div class="tab-pane fade in active" id="mall">
                <ul class="template-list-ul clearfix">
                </ul>
            </div>
            <!--<div class="tab-pane fade" id="goods">-->
                <!--<ul class="template-list-ul clearfix">-->
                <!--</ul>-->
            <!--</div>-->
            <!--<div class="tab-pane fade" id="follow">-->
                <!--<ul class="template-list-ul clearfix">-->
                <!--</ul>-->
            <!--</div>-->
            <!--<div class="tab-pane fade" id="mini_shop">-->
                <!--<ul class="template-list-ul clearfix">-->
                <!--</ul>-->
            <!--</div>-->
        </div>
    </div>
</form>
<script id="tpl_template_list" type="text/html">
    <%each data as item%>
    <li>
        <div class="template-list-pic"><img src="<%item.template_logo%>" alt=""></div>
        <p class="template-list-title"><%item.poster_name%></p>
        <p class="template-list-button">
            <a href="javascript:void(0);" data-type="<%type%>" data-poster-id="<%item.poster_id%>"
               class="template-list-button-a J-create">立即创建</a>
        </p>
    </li>
    <%/each%>
</script>
<script>
    require(['util', 'tpl'], function (util, tpl) {
        getSystemTemplateList();

        function getSystemTemplateList() {
            $.ajax({
                type: "post",
                data: {},
                url: "{$posterSystemDefaultTemplateUrl}",
                success: function (data) {
                    $.each(data, function (type, list) {
                        var target = '#mall ul';
                        switch (type) {
                            case '1':
                                target = '#mall ul';
                                break;
                            case '2':
                                target = '#goods ul';
                                break;
                            case '3':
                                target = '#follow ul';
                                break;
                            case '4':
                                target = '#mini_shop ul';
                                break;
                        }
                        $(target).html(tpl('tpl_template_list', {data: list, type: type}));
                    })
                }
            })
        }

        $('#content_type').on('click', '.J-create', function () {
            /*var type = $(this).attr('data-type');
            var poster_id = $(this).attr('data-poster-id');
            console.log(poster_id);
            $.ajax({
                type: 'post',
                url: '{$createPosterUrl}',
                data: {
                    'type': type,
                    'poster_id': poster_id
                },
                success: function (res) {
                    console.log(res);return;
                    if (res.code > 0) {
                        // util.message(res.message, 'success', __URL(PLATFORMMAIN + 'ADDONS_MAINminiProgramCustom&id=' + res.data.id));
                        console.log(res.data.poster_id);return;
                        window.location = __URL('ADDONS_MAINposter&poster_id=' + res.data.poster_id)
                    } else {
                        util.message(res.message, 'error');
                    }
                }
            });*/
            var poster_id = $(this).attr('data-poster-id');
            window.location = __URL('ADDONS_MAINposter&poster_id=' + poster_id)
        });
    });
</script>